package org.example.gc;
/**
 * -XX:+PrintCommandLineFlags
 * -Xmx20m -Xmn20m -XX:+PrintGCDetails -Xloggc:../logs/gc.log
 *
 * -Xms20M -Xmx20m -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseSerialGC
 * @author youshang
 * @date 2022/04/01 11:25
 **/
public class GCLogTest {
    static int size = 1024 * 1024;
    public static void main(String[] args) throws InterruptedException {
        test();
    }
    public static void test(){
        //byte[] bytes1,bytes2,bytes3,bytes4;
        byte[] bytes1 = new byte[2 * size];
        byte[] bytes2 = new byte[2 * size];
        byte[] bytes3 = new byte[2 * size];
        byte[] bytes4 = new byte[4 * size];
    }
    /*
    [GC (Allocation Failure) [DefNew: 6313K->617K(9216K), 0.0028607 secs] 6313K->4713K(19456K), 0.0028858 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
Heap
 def new generation   total 9216K, used 7085K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000)
  eden space 8192K,  78% used [0x00000007bec00000, 0x00000007bf250e58, 0x00000007bf400000)
  from space 1024K,  60% used [0x00000007bf500000, 0x00000007bf59a748, 0x00000007bf600000)
  to   space 1024K,   0% used [0x00000007bf400000, 0x00000007bf400000, 0x00000007bf500000)
 tenured generation   total 10240K, used 4096K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000)
   the space 10240K,  40% used [0x00000007bf600000, 0x00000007bfa00020, 0x00000007bfa00200, 0x00000007c0000000)
 Metaspace       used 2960K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 327K, capacity 388K, committed 512K, reserved 1048576K
     */
}
